<?php
/* [DoYouHaoBaby!] (C)Dianniu From 2010.
   this($)*/

!defined('DYHB_PATH') && exit;

class TemplateGtkGladeWidgetCompiler_GtkButtonBox extends TemplateGtkGladeWidgetCompiler_GtkBox{

	protected function compileCreateWidget_(TemplateGtkGladeWidget $oObject){
		$sCompiled=TemplateGtkGladeWidgetCompiler_GtkBox::compileCreateWidget_($oObject);
		$sVariableName='$'.TemplateGtkGlade::getWidgetVariableName($oObject);
		$sLayout=($sLayout=$oObject->getProperty('layout_style'))?$sLayout:'GTK_BUTTONBOX_DEFAULT_STYLE';
		$sLayout=str_replace('GTK_','Gtk::',$sLayout);
		$sCompiled.= "\t\t{$sVariableName}->set_layout({$sLayout});";
		return $sCompiled;
	}

	protected function compileChildWidgetPacking_(TemplateGtkGladeWidget $oParentWidget,TemplateGtkGladeWidget $oChildWidget, TemplateGtkGladeWidgetPacking $oPacking){
		$sCompiled=TemplateGtkGladeWidgetCompiler_GtkBox::compileChildWidgetPacking_($oParentWidget,$oChildWidget,$oPacking);
		$sParentVariableName='$'.TemplateGtkGlade::getWidgetVariableName($oParentWidget);
		$sChildWidgetVariableName='$'.TemplateGtkGlade::getWidgetVariableName($oChildWidget);
		$sChildWidgetId=$oChildWidget->getWidgetId();
		if($oPacking->getProperty('secondary')){$sCompiled.= "\t\t{$sParentVariableName}->set_child_secondary({$sChildWidgetVariableName},true);";}// 二级
		return $sCompiled;
	}

	static public function regToProcessorManager(ITemplateObjProcessorManager $oManager){
		$oManager->regProcessor(str_replace('TemplateGtkGladeWidgetCompiler_','',__CLASS__),__CLASS__);
	}

}
